<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
</head>
<body>
<script>
    var doc = document;
    // Create a fake element
    var div = doc.createElement('div');
    div.appendChild(doc.createComment(''));

    // Make sure no comments are found
    console.log(div.getElementsByTagName('*').length);
</script>
</body>
</html>